package com.itheima;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        System.out.println("请输入您的生日(如1999-01-01-01-01-01)");
        String birthday = sc.next();
        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm-ss");
        LocalDateTime localDateTime = LocalDateTime.parse(birthday, pattern);
        int yearBirthday = localDateTime.getYear();
        LocalDateTime now = LocalDateTime.now();
        int yearNow = now.getYear();
        System.out.println("您的年龄为"+(yearNow-yearBirthday+1));

    }
}
